﻿using System.Diagnostics;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Content;

using YEngineLib;
using YEngineLib.Graphics;
using YEngineLib.Input;
using YEngineLib.State;
using YEngineLib.Util;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

using System.Threading;
using Spyfall.Objects;

namespace Spyfall.States
{
    class HowToPlayPausedState : YBaseGameState
    {
        //States
        GamePadState currentGamePadState;
        GamePadState previousGameState;
        //Fonts
        SpriteFont spriteFont;
        //Which controller the Player is using
        public PlayerIndex playerIndex;
        //objectManager
        private Managers.ObjectManager objectManager;
        //screenPosition;
        Vector2 screenPosition;

        public HowToPlayPausedState()
        {
            objectManager = new Managers.ObjectManager();
            screenPosition = new Vector2(10.0f, 30.0f);
        }

        public override void LoadContent()
        {
            LoadPercentage = 100.0f;
            spriteFont = YEngine.Game.Content.Load<SpriteFont>("Fonts/SpriteFont1");
        }

        public override void Input()
        {
            previousGameState = currentGamePadState;
            currentGamePadState = GamePad.GetState(playerIndex);

            //Keyboard shortcut to return back to the mainmenu
            if (YEngine.Input.Keyboard.KeyPressed(Keys.Enter))
            {
                YEngine.State.ChangeState("PauseState");
                return;
            }
        }

        public override void Update()
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed)
            {
                YEngine.Game.Exit();
                objectManager.UpdateObjects((float)YEngine.Time.GameTime.ElapsedGameTime.TotalSeconds);
            }
        }

        public override void Draw()
        {
            YEngine.Graphics.SpriteBatch.Begin();
            YEngine.Graphics.SpriteBatch.DrawString(spriteFont, "How To Play State TO AND FROM PAUSED Prototype", screenPosition, Color.White);
            YEngine.Graphics.SpriteBatch.End();
        }

    }
}


